<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" content="">
		<title>core - transition.styleTween(name, tween[, priority])</title>
		<script type="text/javascript" src="../../d3.js"></script>
	</head>
	<body>

		<script type="text/javascript">
			//向body标签增加svg子元素
			var svg = d3.select('body')
				.append('svg')	
				.attr({
					"width": 700,
					"height": 500,
				});

			//追加测试圆
			svg.append('circle')
				.attr({
					cx: 100,
					cy: 100,
					r: 50
				});
			

			svg.select('circle')
				.transition()	//开启动画
				.duration(1500)	//设置动画持续时间1500毫秒
				.styleTween("fill", tween)	//对填充样式调用自定义的补间函数

			function tween(d, i, a) {//补间函数，设置圆的填充颜色从绿色过渡到橘黄色
				return d3.interpolate("green", "orange");
			}
			
		</script>
	</body>
</html>